systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
swapoff -a
sed -i '/swap/s/^\(.*\)$/#\1/g' /etc/fstab
iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat && iptables -P FORWARD ACCEPT
yum -y update
yum -y install wget vim ntpdate
yum install -y conntrack ipvsadm ipset jq sysstat curl iptables libseccomp yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": ["https://4p7x5ukg.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
yum install -y docker-ce
systemctl start docker && systemctl enable docker
cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
ntpdate time.windows.com
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
       http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubelet-1.23.14
yum install -y kubectl-1.23.14
yum install -y kubeadm-1.23.14
systemctl restart docker
sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
systemctl enable kubelet && systemctl start kubelet
echo "start kubelet"
docker pull k8s.gcr.io/kube-apiserver:v1.23.14
docker pull k8s.gcr.io/kube-controller-manager:v1.23.14
docker pull k8s.gcr.io/kube-scheduler:v1.23.14
docker pull k8s.gcr.io/kube-proxy:v1.23.14
docker pull k8s.gcr.io/pause:3.6
docker pull k8s.gcr.io/etcd:3.5.5-0
docker pull k8s.gcr.io/coredns/coredns:v1.8.6
docker pull docker.io/calico/kube-controllers:v3.20.3
docker pull docker.io/calico/pod2daemon-flexvol:v3.20.3
docker pull docker.io/calico/node:v3.20.3
docker pull docker.io/calico/cni:v3.20.3
echo "pull images"

